package com.cy3;

import java.io.*;

public class CopyMp4Demo {
    public static void main(String[] args) throws IOException {
        //记录开始时间
        long startTime=System.currentTimeMillis();
        //复制视频
       // method1();    //笑死，我把其他三个方法写出来了还没复制出来，太离谱了！
    //    method2();     //共耗时：552毫秒！
      //  method3();      //   共耗时：709毫秒！
        method4();        //共耗时：120毫秒！


        //记录结束时间
        long endTime=System.currentTimeMillis();
        System.out.println("共耗时："+(endTime-startTime)+"毫秒！");

    }
    public static void method1() throws IOException{
        FileInputStream fis = new FileInputStream("D:\\EntertainmentInformation\\Videos\\MV\\鞠婧祎-青城山下白素贞 (《新白娘子传奇》电视剧插曲)(蓝光).mp4");
        FileOutputStream fos = new FileOutputStream("myByteStream\\鞠婧祎-青城山下白素贞 (《新白娘子传奇》电视剧插曲)(蓝光).mp4");
        int by;
        while((by=fis.read())!=-1){
            fos.write(by);
        }
        fis.close();
        fos.close();
    }
    public static void method2() throws IOException{
        FileInputStream fis = new FileInputStream("D:\\EntertainmentInformation\\Videos\\MV\\鞠婧祎-青城山下白素贞 (《新白娘子传奇》电视剧插曲)(蓝光).mp4");
        FileOutputStream fos = new FileOutputStream("myByteStream\\鞠婧祎-青城山下白素贞 (《新白娘子传奇》电视剧插曲)(蓝光).mp4");
        byte[] bys = new byte[1024];
        int len;
        while((len=fis.read(bys))!=-1){
            fos.write(bys,0,len);
        }
        fis.close();
        fos.close();
    }
    public static void method3() throws IOException{
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("D:\\EntertainmentInformation\\Videos\\MV\\鞠婧祎-青城山下白素贞 (《新白娘子传奇》电视剧插曲)(蓝光).mp4"));
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("myByteStream\\鞠婧祎-青城山下白素贞 (《新白娘子传奇》电视剧插曲)(蓝光).mp4"));
        int by;
        while((by=bis.read())!=-1){
            bos.write(by);
        }
        bis.close();
        bos.close();
    }
    public static void method4() throws IOException{
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("D:\\EntertainmentInformation\\Videos\\MV\\鞠婧祎-青城山下白素贞 (《新白娘子传奇》电视剧插曲)(蓝光).mp4"));
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("myByteStream\\鞠婧祎-青城山下白素贞 (《新白娘子传奇》电视剧插曲)(蓝光).mp4"));
        byte[] bys = new byte[1024];
        int len;
        while((len=bis.read(bys))!=-1){
            bos.write(bys,0,len);
        }
        bis.close();
        bos.close();


    }


}
